package april.test_4_20;

import java.util.Scanner;

public class TestMain2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String tmp = scanner.nextLine();
        String str = scanner.nextLine();
        int[] dp = new int[n + 3];
        dp[0] = 1;
        dp[1] = 1;
        for (int i = 2; i <= n; i++) {
            int x = str.charAt(i - 2) - '0';
            int y = str.charAt(i - 1) - '0';
            if(x < 2 || (x == 2 && y <= 6)) {
                dp[i] = dp[i - 2]  + dp[i - 1];
            } else {
                dp[i] = dp[i - 1];
            }
            dp[i] %= (1000000000 + 7);
        }
        System.out.println(dp[n]);
    }
}
